import akshare as ak

# 获取业绩预告数据
stock_yjyg_em_df = ak.stock_yjyg_em(date="20251231")

# 检查数据是否获取成功
if stock_yjyg_em_df is not None and not stock_yjyg_em_df.empty:
    # 写入 CSV 文件
    stock_yjyg_em_df.to_csv("stock_yjyg_em_20250930.csv", index=False, encoding="utf-8-sig")
    print("数据已成功写入 stock_yjyg_em_20250930.csv")
else:
    print("未获取到有效数据，请检查日期或接口状态。")
